# Generated by Django 3.0 on 2020-02-26 15:49

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Artist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True)),
                ('info', models.TextField(blank=True)),
                ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Part',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('instr', models.CharField(max_length=200)),
                ('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tracker.Artist')),
            ],
            options={
                'ordering': ('artist__name',),
            },
        ),
        migrations.CreateModel(
            name='Session',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('date', models.DateField(null=True)),
                ('description', models.TextField()),
                ('artists', models.ManyToManyField(to='tracker.Artist')),
            ],
            options={
                'ordering': ['-date'],
            },
        ),
        migrations.CreateModel(
            name='Track',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('public', models.BooleanField(default=False)),
                ('parts', models.ManyToManyField(to='tracker.Part')),
                ('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tracker.Session')),
            ],
        ),
        migrations.CreateModel(
            name='Version',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('audiofile', models.FileField(upload_to='versions')),
                ('amplispectrogram', models.ImageField(null=True, upload_to='amplispec')),
                ('length', models.DurationField(null=True)),
                ('info', models.TextField(blank=True, null=True)),
                ('public', models.BooleanField(default=True)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('last_modified', models.DateTimeField(auto_now=True)),
                ('track', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tracker.Track')),
            ],
        ),
        migrations.CreateModel(
            name='VersionComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('what', models.TextField()),
                ('when', models.DateTimeField(auto_now_add=True)),
                ('last_modified', models.DateTimeField(auto_now=True)),
                ('where', models.FloatField(null=True)),
                ('version_ref', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tracker.Version')),
                ('who', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddConstraint(
            model_name='track',
            constraint=models.UniqueConstraint(fields=('name', 'session'), name='unique_name_session'),
        ),
        migrations.AddConstraint(
            model_name='session',
            constraint=models.UniqueConstraint(fields=('name', 'date'), name='unique_name_date'),
        ),
        migrations.AddConstraint(
            model_name='part',
            constraint=models.UniqueConstraint(fields=('instr', 'artist'), name='unique_instr_artist'),
        ),
    ]
